<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
  <%
String path = request.getContextPath();
pageContext.setAttribute("APP_PATH",path);
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
    <link href="${APP_PATH}/static/bootstrap-3.3.7-dist/css/bootstrap.min.css" rel="stylesheet">
    <script src="${APP_PATH}/static/bootstrap-3.3.7-dist/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="${APP_PATH}/static/js/jquery-3.3.1.min.js"></script>
    <script type="text/javascript">
  	function submitClick(){
  	var msg="";
  	if($('#selectJob').val()==null){
  		msg+=" 岗位"
  	}
  	if($('#inputName').val()==""){
  		msg+=" 姓名"
  	}
  	if($('#inputID').val()==""){
  		msg+=" 身份证号"
  	}
  	if($('#inputOrigin').val()==""){
  		msg+=" 籍贯"
  	}
  	if($('#inputAge').val()==""){
  		msg+=" 年龄"
  	}
  	if($('#inputSex').val()==""){
  		msg+=" 性别"
  	}
  	if($('#inputTall').val()==""){
  		msg+=" 身高"
  	}
  	if($('#inputPhone').val()==""){
  		msg+=" 联系电话"
  	}
  	if(msg.length>0){
	  	alert("以下信息为必填信息，请补充完整："+msg);
	  	return;
  	}
	  	var str=$('#introductionform').serialize()+"&code=${id}";
	  	$.ajax({
	  		url:"${APP_PATH}/introduction",
	  		data:str,
	  		contentType: "application/x-www-form-urlencoded; charset=utf-8",  
	  		type:"POST",
	  		success:function(result){
			  	window.open("${APP_PATH}/"+result,"_self");
	  		}
	  	});
  	};
  function dept_Change(){
  		document.getElementById("selectJob").options.length=0;
  		$.ajax({
	  		url:"${APP_PATH}/job?deptId="+$('#selectDept').val(),
	  		contentType: "application/x-www-form-urlencoded; charset=utf-8",  
	  		type:"POST",
	  		success:function(result){
	  		if(result.code==100){
	  			var jobs = result.result.jobs;
		  		$.each(jobs,function(index,job){
		  		    $("#selectJob").append("<option value='"+job.idjob+"'>"+job.jobname+"</option>");
		  		});   
            }
            else{
            	alert(result.msg)
            } 
	  		}
	  		});
  	}
  </script>
    <base href="<%=basePath%>">
    <title>简历6</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
  <style>
    .headercolor { 
      background-color: #99d9ea; }
  </style>
  
  </head>
  
  <body>
  <div class="headercolor">
  <br/>
  <br/>
  <p class="text-center"><img src="${APP_PATH}/images/logo.jpg" alt="logo" width="600" height="300"/></p>
  <br/>
  </div>
  <h1><p class="text-center">个人简历</p></h1>
<form id="introductionform" class="form-horizontal">
  <div class="form-group">
  <label for="selectJob"class="col-sm-2 control-label">应聘职位</label>
    <div class="col-sm-4">
    <select id="selectDept" name="deptId" class="form-control"  onchange="dept_Change()">
      <c:forEach items="${deptments}" var="dept">
      	<c:if test="${dept.id == introduction.deptId}"> <option value ="${dept.id}" selected="selected">${dept.name}</option></c:if> 
       <c:if test="${dept.id != introduction.deptId}"> <option value ="${dept.id}">${dept.name}</option></c:if>
      </c:forEach>
    </select>
    </div>
    <label for="selectJob"class="col-sm-2 control-label">应聘职位</label>
    <div class="col-sm-4">
    <select id="selectJob"  name="job" class="form-control">
      <c:forEach items="${jobs}" var="job">
      	<c:if test="${job.idjob == introduction.job}"> <option value ="${job.idjob}" selected="selected">${job.jobname}</option></c:if> 
       <c:if test="${job.idjob != introduction.job}"> <option value ="${job.idjob}">${job.jobname}</option></c:if>
      </c:forEach>
    </select>
    </div>
  </div>
  <div class="form-group">
    <label for="inputName" class="col-sm-2 control-label">姓名</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputName" name="name" value=${introduction.name}>
    </div>
    <label for="inputSex" class="col-sm-2 control-label">性别</label>
    <div class="col-sm-4">
    <c:if test="${'M' == introduction.sex}">
      <label class="radio-inline">
	    <input type="radio" name="sex" id="inlineRadio1" value="M" checked>   男    
	  </label>
	  <label class="radio-inline">
	    <input type="radio" name="sex" id="inlineRadio2" value="F">  女     
	  </label>
	</c:if>
	<c:if test="${'F' == introduction.sex}">
      <label class="radio-inline">
	    <input type="radio" name="sex" id="inlineRadio1" value="M">   男    
	  </label>
      <label class="radio-inline">
		<input type="radio" name="sex" id="inlineRadio2" value="F" checked>  女     
      </label>
	</c:if>
    </div>
  </div>
  <div class="form-group">
    <label for="inputAge" class="col-sm-2 control-label">年龄</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputAge" name="age" value=${introduction.age}>
    </div>
    <label for="inputOrigin" class="col-sm-2 control-label">籍贯</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputOrigin" name="origin" value=${introduction.origin}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputTall" class="col-sm-2 control-label">身高</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputTall" name="tall" value=${introduction.tall}>
    </div>
    <label for="inputMarriage" class="col-sm-2 control-label">婚姻状况</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputMarriage" name="marriage" value=${introduction.marriage}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputEdu" class="col-sm-2 control-label">学历</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputEdu" name="education" value=${introduction.education}>
    </div>
    <label for="inputPolitics" class="col-sm-2 control-label">政治面貌</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputPolitics"  name="politics" value=${introduction.politics}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputCollege" class="col-sm-2 control-label">毕业院校</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputCollege" name="colloge" value=${introduction.colloge}>
    </div>
    <label for="inputmajor" class="col-sm-2 control-label">主修专业</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputmajor"  name="major" value=${introduction.major}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputPhone" class="col-sm-2 control-label">联系电话</label>
    <div class="col-sm-4">
      <input type="phone" class="form-control" id="inputPhone" name="phone" value=${introduction.phone}>
    </div>
    <label for="inputEmail" class="col-sm-2 control-label">电子邮件</label>
    <div class="col-sm-4">
      <input type="email" class="form-control" id="inputEmail"  name="email" value=${introduction.email}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputID" class="col-sm-2 control-label">身份证号</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputID" name="idno" value=${introduction.idno}>
    </div>
    <label for="inputBPhone" class="col-sm-2 control-label">紧急电话</label>
    <div class="col-sm-4">
      <input type="text" class="form-control" id="inputBPhone"  name="bphone" value=${introduction.bphone}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputAddres" class="col-sm-2 control-label">现住地址</label>
    <div class="col-sm-10">
      <input type="text" class="form-control" id="inputAddres"  name="address" value=${introduction.address}>
    </div>
  </div>
  <div class="form-group">
    <label for="inputFamily" class="col-sm-2 control-label">家庭情况</label>
    <div class="col-sm-10">
      <textarea rows="5" cols="20"  type="text" class="form-control" id="inputFamily" name="family">${introduction.family}</textarea>
    </div>
  </div>
  <div class="form-group">
    <label for="inputEduExp" class="col-sm-2 control-label">教育经历</label>
    <div class="col-sm-10">
      <textarea rows="5" cols="20"  type="text" class="form-control" id="inputEduExp" name="eExperience">${introduction.eExperience}</textarea>
    </div>
  </div>
  <div class="form-group">
    <label for="inputJobExp" class="col-sm-2 control-label">工作经历</label>
    <div class="col-sm-10">
      <textarea rows="5" cols="20"  type="text" class="form-control" id="inputJobExp" name="wExperience">${introduction.wExperience}</textarea>
    </div>
  </div> </div>
  </div>
  <div class="form-group">
    <label for="inputSkills" class="col-sm-2 control-label">技能特长</label>
    <div class="col-sm-10">
      <textarea rows="5" cols="20"  type="text" class="form-control" id="inputSkills" name="skills">${introduction.skills}</textarea>
    </div>
  </div>
  <div class="form-group">
    <label for="inputIntroduction" class="col-sm-2 control-label">自我介绍</label>
    <div class="col-sm-10">
      <textarea rows="5" cols="20"  type="text" class="form-control" id="inputIntroduction" name="introduction">${introduction.introduction}</textarea>
    </div>
  </div>
  <br/>
  <div class="form-group">
    <p class="text-center">
      <button type="button" class="btn btn-info btn-lg" onclick="submitClick()">提交</button>
    </p>
  </div>
</form>
</body>
</html>